package com.study.ming.feign.fallback;

import com.study.ming.feign.WeatherService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class WeatherFallbackFactory implements FallbackFactory<WeatherService> {
    private static final Logger log = LoggerFactory.getLogger(WeatherFallbackFactory.class);

    @Override
    public WeatherService create(Throwable cause) {
        log.info("调用天气服务失败...");
        return new WeatherService() {
            @Override
            public String getByCity(Integer id) {
                System.out.println("=====================");
                return "fall back ";
            }
        };
    }
}
